#pragma once

#include "Includes.h"

#include "Thread.h"

typedef void (*OnCloseCallback)(SOCKET);

class NetworkEventReceiver : public Thread {
public:
	NetworkEventReceiver();
	void registerOnClose( SOCKET s, OnCloseCallback callback);

	//Thread
	void run() override;
private:
	HANDLE mEvents[WSA_MAXIMUM_WAIT_EVENTS];
	SOCKET mSockets[WSA_MAXIMUM_WAIT_EVENTS];
	OnCloseCallback mCallbacks[WSA_MAXIMUM_WAIT_EVENTS];
	int mNumSockets;

};